import { routerReducer } from "react-router-redux";
import { combineReducers } from "redux-immutable";
import { LOCATION_CHANGE } from 'react-router-redux';

import { ROUTER_INITIAL_STATE } from "../common";

import client from "./client";
 
const routingReducer = (state = ROUTER_INITIAL_STATE, action) => {
    if (action.type === LOCATION_CHANGE) {
        return state.merge({
            locationBeforeTransitions: action.payload
        });
    }
    return state;
};

// Add the reducer to your store on the `routing` key
export default combineReducers({
	client,
	routing: routingReducer
});